using System.Collections.Generic;
using NEasy.Ldap.Entity;

namespace NEasy.Ldap
{
    public interface ILdapRepository
    {
        /// <summary>
        /// Find a principal with his username
        /// </summary>
        T Find<T>(T filterObject) where T : LdapObjectBase, new();

        /// <summary>
        /// Update entity in AD
        /// </summary>
        /// <param name="entity">entity</param>
        bool Update<T>(T entity) where T : LdapObjectBase;

        /// <summary>
        /// saves a new ad account into AD
        /// </summary>
        /// <param name="entity">entity</param>
        bool SaveNew<T>(T entity) where T : LdapObjectBase;

        /// <summary>
        /// set the password of an entity
        /// </summary>
        /// <param name="entity">entity</param>
        /// <param name="password">password</param>
        bool SetPassword<T>(T entity, string password) where T : LdapObjectBase;

        /// <summary>
        /// returns a filtered resultset from ldap
        /// </summary>
        /// <param name="filterQuery"></param>
        /// <returns></returns>
        IEnumerable<T> Filter<T>(string filterQuery) where T : LdapObjectBase, new();
    }
}